import request from "@/utils/request";

// 1.获取用户分页列表
export const reqGetUserList = (page = 1, limit = 5) => {
    return request.get(`/admin/acl/user/${page}/${limit}`);
};
// 2.查询用户
export const reqSearchUserList = (page = 1, limit = 5, username) => {
    return request.get(`/admin/acl/user/${page}/${limit}?username=${username}`);
};
// 3.新增用户
export const reqAddUser = (data) => {
    return request.post(`/admin/acl/user/save`, data);
};
// 4.修改用户
export const reqEditUser = (data) => {
    return request.put(`/admin/acl/user/update`, data);
};
// 5.删除用户
export const reqDeleteUser = (id) => {
    return request.delete(`/admin/acl/user/remove/${id}`);
};
// 6.获取用户角色信息
export const reqGetRoleInfo = (userId) => {
    return request.get(`/admin/acl/user/toAssign/${userId}`);
};
// 7.修改用户角色
export const reqChangeUserRole = (data) => {
    const userId = data.userId;
    const idString = data.roleId.join();
    return request.post(
        `/admin/acl/user/doAssign?userId=${userId}&roleId=${idString}`
    );
};
// 8.批量删除用户
export const reqMutiDeleteUser = (idList) => {
    return request.delete(`/admin/acl/user/batchRemove`, idList);
};
